//app.js
App({
  onLaunch: function () {
    this.getNavHeight();
  },
  getNavHeight() {
    // 获取页面宽度
    let windowWidth;
    wx.getSystemInfo({
      success: (res) => {
        console.log(res);
        windowWidth = res.windowWidth;
      },
    })
    // 获取胶囊信息 menuButton.top == this.globalData.statusBarHeight
    let menuButton  = wx.getMenuButtonBoundingClientRect();
    console.log(menuButton);
    this.globalData.statusBarHeight = menuButton.top;
    this.globalData.titleBarHeight =  menuButton.height;
    // 获取胶囊到右侧距离
    this.globalData.rightMenuButton = windowWidth - menuButton.right;
    this.globalData.centerBarWidth = menuButton.width / 2 +  this.globalData.rightMenuButton;
  },
  globalData: {
    userInfo: null,
    titleBarHeight: '',
    statusBarHeight: '',
    rightMenuButton:'',
    centerBarWidth:''
  }
})